Diffie Hellman: p^x mod q as a one way function, if p and q are primes, and this function distributes uniformly - p and q are agreed. private keys are x's and result of mods are sent out publicly. substituting p by the shared mod, gives the shared secret.